﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FieldList.aspx.cs" Inherits="Manage_Cms_Fieldlist" %>

<html>
<head>
    <!--#include file="../js/html_head.inc"-->
    <link rel="stylesheet" type="text/css" href="../Themes/<%=ManageHelper.GetTheme()%>/style.css" />
</head>
<body>

    <script type="text/javascript">
    function ChangePage()
    {
        var modelid=$('#NodeIDDropDownList').val();
        window.location.href='FieldList.aspx?siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&modelid='+modelid;
    }
    </script>

    <div class="column">
        <div class="columntitle">
            内容模型选择</div>
        <div class="columnsubtitle" style="height: 28px; padding: 5px;">
            栏目：
            <select name="nodeiddropdownlist" onchange="ChangePage()" id="NodeIDDropDownList">
                <%
                    foreach (KeRui.Model.CmsModel model in listCmsModel)
                    {
                        if (model.ModelID == KeRui.Common.PageRequest.GetInt("modelid", -1))
                        {
                %>
                <option value="<%=model.ModelID %>" selected="selected">
                    <%=model.ModelName %>
                </option>
                <%
                    }
                    else
                    {
                %>
                <option value="<%=model.ModelID %>">
                    <%=model.ModelName %>
                </option>
                <%
                    }
                } %>
            </select>
        </div>
    </div>
    <div class="column">
        <div class="columntitle" style="text-align: right; height: 20px; vertical-align: middle;">
            <span style="float: left">对应字段管理</span><span style="float: right"><img src="/Manage/Pic/Icons/newwindow.gif"
                align="absmiddle" title="所有字段" />&nbsp;<a href="FieldList.aspx?siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&modelid=<%=KeRui.Common.PageRequest.GetInt("modelid", -1) %>&show=all"
                    style="font-size: 12px; <%=show=="all"?"font-weight: bold;": ""%>">所有字段</a>&nbsp;&nbsp;</span><span><img
                        src="/Manage/Pic/Icons/newwindow.gif" align="absmiddle" title="正在使用字段" />&nbsp;<a
                            href="FieldList.aspx?siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&modelid=<%=KeRui.Common.PageRequest.GetInt("modelid", -1) %>&show=using"
                            style="font-size: 12px; <%=show=="using"?"font-weight: bold;": ""%>">正在使用字段</a></span>&nbsp;&nbsp;</div>
        <table cellspacing="1" cellpadding="1" rules="all" align="center" border="0" id="MyDataGrid"
            style="border-width: 0px; width: 100%;">
            <tr class="summary-title" align="center" style="height: 25px;">
                <td>
                    字段ID</td>
                <td>
                    字段名</td>
                <td>
                    字段别名</td>
                <td>
                    字段类型</td>
                <td>
                    是否允许为空</td>
                <td>
                    是否启用搜索</td>
                <td>
                    是否显示</td>
                <td>
                    字段描述</td>
                <td>
                    操作</td>
            </tr>
            <%
                foreach (KeRui.Model.CmsField model in listCmsField)
                {
            %>
            <tr class="tdbg" onmouseover="this.className='tdbg-dark';" align="center" onmouseout="this.className='tdbg';"
                style="height: 23px;">
                <td>
                    <%=model.FieldID %>
                </td>
                <td>
                    <%=model.FieldName %>
                </td>
                <td>
                    <%=model.FieldAlias %>
                </td>
                <td>
                    <%=Enum.GetName(typeof(ManageEnum.CmsFieldType), model.FieldType) %>
                </td>
                <td>
                    <%=model.EnableNull ? "<img src='/Manage/Pic/icon/true.gif' alt='允许为空'>" : "<img src='/Manage/Pic/icon/false.gif' alt='不允许为空'>"%>
                </td>
                <td>
                    <%=model.EnableSearch ? "<img src='/Manage/Pic/icon/true.gif' alt='启用'>" : "<img src='/Manage/Pic/icon/false.gif' alt='未启用'>"%>
                </td>
                <td>
                    <%=model.IsUsing ? "<img src='/Manage/Pic/icon/true.gif' alt='启用'>" : "<img src='/Manage/Pic/icon/false.gif' alt='未启用'>"%>
                </td>
                <td>
                    <%=model.Description %>
                </td>
                <td>
                    <a style="cursor: pointer; color: #0a4173;" onclick="<%if(model.ModelID!=0)
                    {
                        Response.Write("window.location.href=\'FieldList.aspx?siteid="+KeRui.Common.PageRequest.GetInt("siteid",-1)+"&act=modshow&modelid="+KeRui.Common.PageRequest.GetInt("modelid",-1) +"&show="+KeRui.Common.PageRequest.GetString("show")+"&fieldid="+model.FieldID+"\'");
                    }
                    else
                    {
                        Response.Write(string.Empty);
                    }%>" <%=model.ModelID==0?"disabled='disabled'":string.Empty %>>
                        <%=model.IsUsing?"不显示":"显示" %>
                    </a>&nbsp<a <%=model.ModelID==0?"disabled='disabled'":string.Empty %> style="cursor: pointer;
                        color: #0a4173;" onclick="<%if(model.ModelID!=0)
                    {%>
                       ymPrompt.win('FieldItem.aspx?siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&act=modify&fieldID=<%=model.FieldID %>',600,540,'修改字段',null,null,null,true);

                        <%}%>">修改</a>&nbsp<a style="cursor: pointer; color: #0a4173;" <%=model.ModelID==0?"disabled='disabled'":string.Empty %>
                            onclick="<%if(model.ModelID!=0)
                    {
                        Response.Write("if(confirm(\'确认删除"+model.FieldName+"字段吗？表结构将作更改并删除字段数据！\')){window.location.href=\'FieldList.aspx?siteid="+KeRui.Common.PageRequest.GetInt("siteid",-1)+"&act=delete&modelid="+KeRui.Common.PageRequest.GetInt("modelid",-1) +"&show="+KeRui.Common.PageRequest.GetString("show")+"&fieldid="+model.FieldID+"\'}");
                    }
                    else
                    {
                        Response.Write("");
                    }%>">删除</a>
                </td>
            </tr>
            <%  
                } %>
        </table>
    </div>
    <table width="95%" align="center">
        <tr>
            <td align="right">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td>
                            <input <%=KeRui.Common.PageRequest.GetInt("modelid", 0)==0?"style='display:none;'":"" %>style=""
                                type="button" name="AddChannel" value="快速添加" onclick="ymPrompt.win('FieldItem.aspx?siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&modelid=<%=KeRui.Common.PageRequest.GetInt("modelid", -1) %>&act=add',600,540,'添加字段',null,null,null,true);"
                                id="AddChannel" class="button" />&nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>
